package com.ctg.itrdc.imageconsole.service.impl;

import javax.annotation.Resource;

import org.springframework.stereotype.Component;

import com.ctg.itrdc.imageconsole.data.dao.ISystemNoticeDao;
import com.ctg.itrdc.imageconsole.data.entity.SystemNotice;
import com.ctg.itrdc.imageconsole.service.ISystemNoticeService;
import com.ctg.itrdc.imageconsole.util.SysManagerUtil;
import com.ctg.itrdc.paspsdk.common.entity.PageInfo;

/**
 * 
 * @Description 
 * @author wupiao
 * @since 2017年2月22日
 */
@Component("systemNoticeService")
public class SystemNoticeServiceImpl implements ISystemNoticeService {


	@Resource
	private ISystemNoticeDao systemNoticeDao;

	@Override
	public PageInfo<SystemNotice> queryNoticePageList(SystemNotice systemNotice, int currentPage, int perPageNum) {

		PageInfo<SystemNotice> pageInfo = systemNoticeDao.jdbcFindPageInfo(systemNotice, currentPage,
				perPageNum, SysManagerUtil.isRoleOfDockerManager());

		return pageInfo;
	}

	@Override
	public int modifyNotice(SystemNotice systemNotice) {
		SystemNotice noticeByQuery = systemNoticeDao.selectByPrimaryKey(systemNotice);
		noticeByQuery.setNoticeState(systemNotice.getNoticeState());
		
		return systemNoticeDao.updateByPrimaryKey(noticeByQuery);
	}

	@Override
	public SystemNotice queryNoticeDetail(SystemNotice systemNotice) {
		return systemNoticeDao.selectByPrimaryKey(systemNotice);
	}

}
